import { Logistics } from 'logistics-model.js';
var logistics = new Logistics();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    loadingHidden: false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var order_id = options.id;
    var params = {"order_id":order_id};
    logistics.getLogisticsDetail(params,data=>{
      var traces = data.items.Traces;
      var timeArr = [];
      for (let i = 0; i < traces.length;i++){
        timeArr = traces[i].AcceptTime.split(' ')
        traces[i].AcceptTime = timeArr;
      }
      this.setData({
        tracesData: traces,
        shipping_name: data.shipping_name,
        logisticCode: data.items.LogisticCode,
        orderCode: data.items.OrderCode,
        loadingHidden: true,
      })
    })
  },
  copy:function(){
    wx.setClipboardData({
      data: this.data.logisticCode,
      success: function (res) {
        wx.showToast({
          title: '复制成功',
          icon: 'none',
          duration: 1000
        })
      }
    })
  }
})